//
//  LZQ_Tools.swift
//  SwiftExercise
//
//  Created by 罗宗庆 on 2021/6/24.
//

import Foundation



class Tools:NSObject{
    
    static let tool = Tools()
    
    //mark - 跳转页面相关设置
    public func pushViewController(controller: UIViewController) {
        let tabbarVC = UIApplication.shared.keyWindow?.rootViewController as! BaseTabBarController
        let nav = tabbarVC.selectedViewController as! ZXNavigationBarNavigationController
        nav.pushViewController(controller, animated: true)
    }

    public func popViewController(){
        let tabbarVC = UIApplication.shared.keyWindow?.rootViewController as! BaseTabBarController
        let nav = tabbarVC.selectedViewController as! ZXNavigationBarNavigationController
        nav.popViewController(animated: true)
    }
    public func popToRootViewController(){
        let tabbarVC = UIApplication.shared.keyWindow?.rootViewController as! BaseTabBarController
        let nav = tabbarVC.selectedViewController as! ZXNavigationBarNavigationController
        nav.popToRootViewController(animated: true)
    }

    public func dismissViewController(){
        let tabbarVC = UIApplication.shared.keyWindow?.rootViewController as! BaseTabBarController
        let nav = tabbarVC.selectedViewController as! ZXNavigationBarNavigationController
        nav.dismiss(animated: true, completion: nil)
    }

    public func presentViewController(controller : UIViewController){
        let tabbarVC = UIApplication.shared.keyWindow?.rootViewController as! BaseTabBarController
        let nav = tabbarVC.selectedViewController as! ZXNavigationBarNavigationController
        nav.present(controller, animated: true, completion: nil)
    }
}


